﻿<Window x:Class="UI.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:r="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary"
    xmlns:ad="clr-namespace:AvalonDock;assembly=AvalonDock"
    xmlns:controls="clr-namespace:UI.Controls"
    xmlns:cal="http://www.codeplex.com/CompositeWPF"
    Title="Book Cataloger" Height="600" Width="800"
        Closing="Window_Closing"
        Loaded="Window_Loaded">
	<Window.Resources>
		<DataTemplate x:Key="WindowDataTemplate">
			<StackPanel>
				<TextBlock Text="{Binding Title}" />
			</StackPanel>
		</DataTemplate>
	</Window.Resources>
    <DockPanel >
        <r:Ribbon DockPanel.Dock="Top" >
            <r:Ribbon.Resources>
                <ResourceDictionary>

                    <r:RibbonCommand x:Key="NewBookCommand"
                                Executed="RibbonCommand_NewBook"
                                LabelTitle="Book"
                                ToolTipTitle="New Book"
                                ToolTipDescription="Save a new book."
                                SmallImageSource="Images/1256219326_Library.png"
                                LargeImageSource="Images/1256219326_Library.png" />
                    <r:RibbonCommand x:Key="NewJournalCommand"
                                LabelTitle="Journal"
                                ToolTipTitle="New Journal"
                                ToolTipDescription="Save a new journal." />
                    <r:RibbonCommand x:Key="NewThesisCommand"
                                LabelTitle="Thesis"
                                ToolTipTitle="New Thesis"
                                ToolTipDescription="Save a new thesis." />
                    <r:RibbonCommand x:Key="SaveLayout"
                                Executed="SaveLayout_Executed"
                                LabelTitle="Save"
                                ToolTipTitle="Save"
                                ToolTipDescription="Save current layout." />
                    <r:RibbonCommand x:Key="Exit"
                                Executed="RibbonCommand_ExitApplication"                                 
                                LabelTitle="Exit"/>
                    <r:RibbonCommand x:Key="Options"
                                Executed="RibbonCommand_Options"
                                LabelTitle="Options..."/>
                    <r:RibbonCommand x:Key="CloseApp"
                                LabelDescription="Close the application."
                                ToolTipTitle="Book cataloger"
                                ToolTipDescription="Click here to open or save a book catalogue." />
                    <r:RibbonCommand x:Key="NewBookshelf"
                                Executed="NewBookshelf_Executed"
                                LabelTitle="New" 
                                LabelDescription="New bookshelf" 
                                ToolTipDescription="Create a new bookshelf." 
                                ToolTipTitle="New"
                                SmallImageSource="Images/1256218891_bookcase.png"
                                LargeImageSource="Images/1256218891_bookcase.png"/>
                    <r:RibbonCommand x:Key="OpenBookshelf"
                                Executed="OpenBookshelf_Executed"
                                LabelTitle="Open" 
                                LabelDescription="Open a bookshelf" 
                                ToolTipDescription="Open an existing bookshelf." 
                                ToolTipTitle="Open"
                                SmallImageSource="Images/1256218982_toggle_log.png"
                                LargeImageSource="Images/1256218982_toggle_log.png"/>
                    <r:RibbonCommand x:Key="PrintBookshelf"
                                LabelTitle="Print" 
                                LabelDescription="Print bookshelf" 
                                ToolTipDescription="Print a list of your books" 
                                ToolTipTitle="Print" />
                    <r:RibbonCommand x:Key="ExportBookshelf"
                                LabelTitle="E_xport" 
                                LabelDescription="Export bookshelf" 
                                ToolTipDescription="Export books to an external file format." 
                                ToolTipTitle="Export"
                                Executed="RibbonCommand_Executed_1"/>
                    <r:RibbonCommand x:Key="CloseBookshelf"
                                Executed="RibbonCommand_Close"
                                LabelTitle="Close" 
                                LabelDescription="Close bookshelf" 
                                ToolTipDescription="Close the currently loaded bookshelf." 
                                ToolTipTitle="Close"
                                SmallImageSource="Images/1256219156_emblem-library.png"
                                LargeImageSource="Images/1256219156_emblem-library.png"/>
                    <r:RibbonCommand x:Key="SplitNewBookshelf"
                                     Executed="NewBookshelf_Executed"
                                LabelTitle="Bookshelf" 
                                LabelDescription="Create a new bookshelf" 
                                ToolTipDescription="Create a new bookshelf" 
                                ToolTipTitle="New Bookshelf"
                                SmallImageSource="Images/1256218891_bookcase.png"
                                LargeImageSource="Images/1256218891_bookcase.png"/>
                    <r:RibbonCommand x:Key="SplitNewBook"
                                Executed="RibbonCommand_NewBook"
                                LabelTitle="Book" 
                                LabelDescription="Create a new book" 
                                ToolTipDescription="Create a new book" 
                                ToolTipTitle="New book"
                                SmallImageSource="Images/1256219326_Library.png"
                                LargeImageSource="Images/1256219326_Library.png"/>
                    <r:RibbonCommand x:Key="SplitNewJournal"
                                LabelTitle="Journal" 
                                LabelDescription="Create a new journal" 
                                ToolTipDescription="Create a new journal" 
                                ToolTipTitle="New Journal" />
                    <r:RibbonCommand x:Key="SplitNewThesis"
                                LabelTitle="Thesis" 
                                LabelDescription="Create a new thesis" 
                                ToolTipDescription="Create a new thesis" 
                                ToolTipTitle="New thesis" />
                    <r:RibbonCommand x:Key="EditDocumentCommand"
                                Executed = "EditDocumentCommand_Executed"         
                                LabelTitle="Edit" 
                                LabelDescription="Edit the selected document" 
                                ToolTipDescription="Edit the selected document" 
                                ToolTipTitle="Edit"
                                LargeImageSource="Images/Rename.png"
                                SmallImageSource="Images/Rename.png"/>
                    <r:RibbonCommand x:Key="DeleteDocumentCommand"
                                Executed="DeleteDocumentCommand_Executed"
                                LabelTitle="Delete" 
                                LabelDescription="Delete the selected document" 
                                ToolTipDescription="Delete the selected document" 
                                ToolTipTitle="Delete"
                                LargeImageSource="Images/delete.png"
                                SmallImageSource="Images/delete.png"/>


                    <r:RibbonCommand x:Key="AboutCommand"
                                Executed="AboutCommand_Executed"
                                LabelTitle="About" 
                                LabelDescription="About the application" 
                                ToolTipDescription="About the application" 
                                ToolTipTitle="About"
                                SmallImageSource="Images/help.png"
                                LargeImageSource="Images/help.png"/>

                    <r:RibbonCommand x:Key="WindowGroupCommand"
                                Executed="WindowsGroupCommand_Executed"
                                LabelTitle="Windows" />

                    <r:RibbonCommand x:Key="ShowPublisherDictionary"
                                Executed="RibbonCommand_Executed"
                                LabelTitle="Publisher" />
                    <r:RibbonCommand x:Key="ShowBindingDictionary"
                                Executed="RibbonCommand_Executed"
                                LabelTitle="Binding" />
                    <r:RibbonCommand x:Key="ShowConditionDictionary"
                                Executed="RibbonCommand_Executed"
                                LabelTitle="Condition" />

                    <r:RibbonGroupSizeDefinitionCollection x:Key="RibbonLayout">
                        <r:RibbonGroupSizeDefinition>
                            <!-- Control sizes: L,L,L -->
                            <r:RibbonControlSizeDefinition ImageSize="Large" IsLabelVisible="True"/>
                            <r:RibbonControlSizeDefinition ImageSize="Large" IsLabelVisible="True"/>
                            <r:RibbonControlSizeDefinition ImageSize="Large" IsLabelVisible="True"/>
                        </r:RibbonGroupSizeDefinition>
                        <r:RibbonGroupSizeDefinition>
                            <!-- Control sizes: L,M,M -->
                            <r:RibbonControlSizeDefinition ImageSize="Large" IsLabelVisible="True"/>
                            <r:RibbonControlSizeDefinition ImageSize="Small" IsLabelVisible="True"/>
                            <r:RibbonControlSizeDefinition ImageSize="Small" IsLabelVisible="True"/>
                        </r:RibbonGroupSizeDefinition>
                        <r:RibbonGroupSizeDefinition>
                            <!-- Control sizes: L,S,S -->
                            <r:RibbonControlSizeDefinition ImageSize="Large" IsLabelVisible="True"/>
                            <r:RibbonControlSizeDefinition ImageSize="Small" IsLabelVisible="False"/>
                            <r:RibbonControlSizeDefinition ImageSize="Small" IsLabelVisible="False"/>
                        </r:RibbonGroupSizeDefinition>
                        <!-- Collapsed -->
                        <r:RibbonGroupSizeDefinition IsCollapsed="True" />
                    </r:RibbonGroupSizeDefinitionCollection>
                    <r:RibbonGroupSizeDefinitionCollection x:Key="Bookshelf">
                        <r:RibbonGroupSizeDefinition>
                            <r:RibbonControlSizeDefinition ImageSize="Large"  />
                            <r:RibbonControlSizeDefinition ImageSize="Small" />
                            <r:RibbonControlSizeDefinition ImageSize="Small" />
                        </r:RibbonGroupSizeDefinition>
                    </r:RibbonGroupSizeDefinitionCollection>
                    <r:RibbonGroupSizeDefinitionCollection x:Key="Document">
                        <r:RibbonGroupSizeDefinition>
                            <r:RibbonControlSizeDefinition ImageSize="Large"  />
                            <r:RibbonControlSizeDefinition ImageSize="Large" />
                            <r:RibbonControlSizeDefinition ImageSize="Large" />
                            <r:RibbonControlSizeDefinition ImageSize="Small" />
                            <r:RibbonControlSizeDefinition ImageSize="Small" />
                        </r:RibbonGroupSizeDefinition>
                    </r:RibbonGroupSizeDefinitionCollection>
                </ResourceDictionary>
            </r:Ribbon.Resources>


            <r:Ribbon.ApplicationMenu>
                <r:RibbonApplicationMenu x:Name="ApplicationMenu" Command="{StaticResource CloseApp}">
                    <r:RibbonApplicationMenuItem Command="{StaticResource NewBookshelf}">
                        <r:RibbonApplicationSplitMenuItem Command="{StaticResource SplitNewBookshelf}" />
                        <Separator />
                        <r:RibbonApplicationSplitMenuItem x:Name="ApplicationNewBook" Command="{StaticResource SplitNewBook}" />
                        <r:RibbonApplicationSplitMenuItem x:Name="ApplicationNewJournal" Command="{StaticResource SplitNewJournal}" />
                        <r:RibbonApplicationSplitMenuItem x:Name="ApplicationNewThesis" Command="{StaticResource SplitNewThesis}" />
                    </r:RibbonApplicationMenuItem>
                    <r:RibbonApplicationMenuItem Command="{StaticResource OpenBookshelf}" />
                    <Separator />
                    <r:RibbonApplicationMenuItem Command="{StaticResource PrintBookshelf}" />
                    <r:RibbonApplicationMenuItem x:Name="ExportMenu" Command="{StaticResource ExportBookshelf}" />
                    <Separator />
                    <r:RibbonApplicationMenuItem x:Name="ApplicationCloseBookshelf" Command="{StaticResource CloseBookshelf}" />
                    <r:RibbonApplicationMenu.Footer>
                        <DockPanel LastChildFill="False">
                            <r:RibbonButton DockPanel.Dock="Right" Margin="2" Command="{StaticResource Exit}" />
                            <r:RibbonButton DockPanel.Dock="Right" Margin="2" Command="{StaticResource Options}" />
                        </DockPanel>
                    </r:RibbonApplicationMenu.Footer>
                </r:RibbonApplicationMenu>
            </r:Ribbon.ApplicationMenu>

            <r:RibbonTab Label="Home">
                <r:RibbonTab.Groups>
                    <r:RibbonGroup GroupSizeDefinitions="{StaticResource Bookshelf}">
                        <r:RibbonGroup.Command>
                            <r:RibbonCommand LabelTitle="Bookshelf" />
                        </r:RibbonGroup.Command>
                        <r:RibbonButton x:Name="HomeOpenBookshelf" Command="{StaticResource OpenBookshelf}" />

                        <r:RibbonButton x:Name="HomeNewBookshelf" Command="{StaticResource NewBookshelf}" />
                        <r:RibbonButton x:Name="HomeCloseBookshelf" Command="{StaticResource CloseBookshelf}" />
                    </r:RibbonGroup>
                    <r:RibbonGroup GroupSizeDefinitions="{StaticResource Document}">
                        <r:RibbonGroup.Command>
                            <r:RibbonCommand LabelTitle="Document" />
                        </r:RibbonGroup.Command>
                        <r:RibbonButton x:Name="HomeNewBook" Command="{StaticResource NewBookCommand}" />
                        <r:RibbonButton x:Name="HomeNewJournal" Command="{StaticResource NewJournalCommand}" />
                        <r:RibbonButton x:Name="HomeNewThesis" Command="{StaticResource NewThesisCommand}" />
                        <r:RibbonButton x:Name="HomeEditDocument" Command="{StaticResource EditDocumentCommand}" />
                        <r:RibbonButton x:Name="HomeDeleteDocument" Command="{StaticResource DeleteDocumentCommand}" />
                    </r:RibbonGroup>
                </r:RibbonTab.Groups>
            </r:RibbonTab>
            <r:RibbonTab x:Name="DictionariesTab" Label="Lists">
                <r:RibbonTab.Groups>
                    <r:RibbonGroup>
                        <r:RibbonButton x:Name="ShowPublisherDictionary" Command="{StaticResource ShowPublisherDictionary}" />
                        <r:RibbonButton x:Name="ShowBindingDictionary" Command="{StaticResource ShowBindingDictionary}" />
                        <r:RibbonButton x:Name="ShowConditionDictionary" Command="{StaticResource ShowConditionDictionary}" />
                    </r:RibbonGroup>
                </r:RibbonTab.Groups>
            </r:RibbonTab>
            <r:RibbonTab Label="Layout" Selected="Layout_Selected" >
                <r:RibbonGroup>
                    <r:RibbonGroup.Command>
                        <r:RibbonCommand LabelTitle="Presets" />
                    </r:RibbonGroup.Command>
                    <r:RibbonButton Command="{StaticResource SaveLayout}" />
                    <r:RibbonComboBox x:Name="LayoutSelector" MinWidth="150" Text="{Binding RelativeSource={RelativeSource Self}, Path=SelectedItem.Content}"  />
                </r:RibbonGroup>
                <r:RibbonGroup HasDialogLauncher="True" Command="{StaticResource WindowGroupCommand}">
                    <r:RibbonComboBox x:Name="WindowSelector" MinWidth="150" Text="{Binding RelativeSource={RelativeSource Self}, Path=SelectedItem.Content}" />
                </r:RibbonGroup>
            </r:RibbonTab>
            <r:RibbonTab Label="About">
                <r:RibbonGroup>
                    <r:RibbonButton x:Name="About" Command="{StaticResource AboutCommand}" />
                </r:RibbonGroup>
            </r:RibbonTab>
        </r:Ribbon>
        <StatusBar Name="statusbar" DockPanel.Dock="Bottom" Height="26">
            <StatusBarItem x:Name="LoadingStatus" Visibility="Collapsed">
                <StackPanel Orientation="Horizontal">
                    <TextBlock Name="LoadMessage" Text="Loading" Padding="0,0,5,0" />
                    <ProgressBar Name="LoadProgress" IsIndeterminate="True" Width="100" Height="20" />
                </StackPanel>
            </StatusBarItem>
        </StatusBar>
        <ad:DockingManager x:Name="dockManager" >
            <ad:ResizingPanel Name="_mainpanel" Orientation="Horizontal">

                <ad:DockablePane x:Name="_leftpane">
                    <ad:DockableContent x:Name="_books" Title="Books" DockableStyle="Dockable" >
                            <ContentControl x:Name="MainRegion" cal:RegionManager.RegionName="MainRegion" />
                    </ad:DockableContent>
                </ad:DockablePane>
                <ad:ResizingPanel x:Name="_verticalpane" Orientation="Vertical">
                    <ad:DockablePane x:Name="_toppane">
                        <ad:DockableContent x:Name="_details" Title="Details" DockableStyle="Dockable" >
                            <ContentControl x:Name="DetailsRegion" cal:RegionManager.RegionName="DetailsRegion" />                            
                        </ad:DockableContent>
                    </ad:DockablePane>
                    <ad:DockablePane x:Name="_bottompane">
                        <ad:DockableContent x:Name="_comments" Title="Comments" DockableStyle="Dockable" MinWidth="50" MinHeight="70">
                            <ContentControl x:Name="CommentEditorRegion" cal:RegionManager.RegionName="CommentEditorRegion" />
                        </ad:DockableContent>
                    </ad:DockablePane>
                </ad:ResizingPanel>
            </ad:ResizingPanel>
        </ad:DockingManager>
    </DockPanel>
</Window>
